package com.dragons.spring5.aop.annotation;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class UserProxy {
    @Before(value = "execution(* com.dragons.spring5.aop.annotation.User4.add(..))")
    public void before() { System.out.println(".........前置通知"); }
    @Around(value = "execution(* com.dragons.spring5.aop.annotation.User4.add(..))")
    public void around(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
        System.out.println(">>>>环绕之前.....");
        proceedingJoinPoint.proceed(); /**被增强的方法执行*/
        System.out.println(">>>>环绕之后.....");
    }
    @After(value = "execution(* com.dragons.spring5.aop.annotation.User4.add(..))")
    public void after() { System.out.println(" .........最终通知"); }
    @AfterThrowing(value = "execution(* com.dragons.spring5.aop.annotation.User4.add(..))")
    public void afterThrowing() { System.out.println(".........异常通知"); }
    @AfterReturning(value = "execution(* com.dragons.spring5.aop.annotation.User4.add(..))")
    public void afterReturning() { System.out.println(".........后置通知"); }
}